<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>ws</title>
</head>
<body>
<h1>ws</h1>
<input class="msg" type="text"/>
<button class="send">发送</button>
<p class="content">收到的：<br/></p>

<!--<script th:src="@{js/jquery.min.js}"></script>-->
<!--<script th:src="@{js/sockjs.min.js}"></script>-->
<!--<script th:src="@{js/stomp.js}"></script>-->
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/sockjs.min.js"></script>
<script src="../static/js/stomp.js"></script>
<script type="text/javascript">
var socket = new SockJS("/socket");
var stomp = Stomp.over(socket);
stomp.connect("guest", "guest", function(frame){
    stomp.subscribe("/user/client", function (message) {
        $(".content").html(message.body);
    })
});

$(".send").click(function () {
    stomp.send("/server/send", {}, $(".msg").val());
});
</script>
</body>
</html>